﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class JoyStickCtrl : UIBase
{
    private ETCJoystick joystick;

    void Start()
    {
        joystick = GetComponent<ETCJoystick>();
        joystick.onMove.AddListener(OnMove);
    }


    private void OnMove(Vector2 direction)
    {
        //角色移动
        //播放动画
        Dispatch(AreaCode.CHARACTER, CharacterEvent.MOVE, direction);
        //走路声音
        Dispatch(AreaCode.AUDIO,AudioEvent.PLAY_AUDIO,"角色行走的声音名称");

    }


    public override void OnDestroy()
    {
        joystick.onMove.RemoveListener(OnMove);
    }

}
